﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Globalization;
using System.Runtime.Serialization;
namespace GSLMS.Entity
{
	/// <summary>
	/// 2.3.78    职员信息表
	/// </summary>
	[DataContract(IsReference = true)]
	public partial class TB_SYS_EMP: IObjectWithChangeTracker, INotifyPropertyChanged
	{
		public TB_SYS_EMP()
		{}
		#region Model
		private long _id;
		private string _empno;
		private string _empname;
		private string _idcard;
		private string _gender;
		private string _birthday;
		private string _duties;
		private long _orgid=-1;
		private string _telcode;
		private string _tel;
		private string _mobile;
		private string _hometelcode;
		private string _hometel;
		private string _officetelcode;
		private string _officetel;
		private string _officetelsub;
		private string _homeaddr;
		private string _post;
		private string _email;
        private int _issalesman = -1;
        private int _isholidays = -1;
        private int _isleave = -1;                     
		private Nullable<DateTime> _leavedate;
        private int _isprincipal = -1;                    
		private string _remark="";
        private int _isuser = -1;
		private string _username;
		private string _logpwd;
		private string _pwdrand;
        private int _usertype = -1;
		private Nullable<DateTime> _lastlogindate;
        private int _userstatus = -1;                     
		private string _createby;
		private Nullable<DateTime> _createtime;
		private string _modifyby;
		private Nullable<DateTime> _modifytime;
		/// <summary>
		/// 记录ID唯一
		/// </summary>
		[DataMember]
		public long ID
		{
			get{return _id;}
			set{
				if ( _id!= value)
				{
					if (ChangeTracker.ChangeTrackingEnabled && ChangeTracker.State != ObjectState.Added)
					{
						throw new InvalidOperationException("属性“ID”是对象键的一部分，不可更改。仅当未跟踪对象或对象处于“已添加”状态时，才能对键属性进行更改。");
					}
					 _id = value;
					OnPropertyChanged("ID");
				}
			}
		}
		/// <summary>
		/// 员工编号
		/// </summary>
		[DataMember]
		public string EMPNO
		{
			get{return _empno;}
			set{
				if ( _empno!= value)
				{
					 _empno = value;
					OnPropertyChanged("EMPNO");
				}
			}
		}
		/// <summary>
		/// 姓名
		/// </summary>
		[DataMember]
		public string EMPNAME
		{
			get{return _empname;}
			set{
				if ( _empname!= value)
				{
					 _empname = value;
					OnPropertyChanged("EMPNAME");
				}
			}
		}
		/// <summary>
		/// 身份证号
		/// </summary>
		[DataMember]
		public string IDCARD
		{
			get{return _idcard;}
			set{
				if ( _idcard!= value)
				{
					 _idcard = value;
					OnPropertyChanged("IDCARD");
				}
			}
		}
		/// <summary>
		/// 性别
		/// </summary>
		[DataMember]
		public string GENDER
		{
			get{return _gender;}
			set{
				if ( _gender!= value)
				{
					 _gender = value;
					OnPropertyChanged("GENDER");
				}
			}
		}
		/// <summary>
		/// 出生日期
		/// </summary>
		[DataMember]
		public string BIRTHDAY
		{
			get{return _birthday;}
			set{
				if ( _birthday!= value)
				{
					 _birthday = value;
					OnPropertyChanged("BIRTHDAY");
				}
			}
		}
		/// <summary>
		/// 职务
		/// </summary>
		[DataMember]
		public string DUTIES
		{
			get{return _duties;}
			set{
				if ( _duties!= value)
				{
					 _duties = value;
					OnPropertyChanged("DUTIES");
				}
			}
		}
		/// <summary>
		/// 所属部门
		/// </summary>
		[DataMember]
		public long ORGID
		{
			get{return _orgid;}
			set{
				if ( _orgid!= value)
				{
					 _orgid = value;
					OnPropertyChanged("ORGID");
				}
			}
		}
		/// <summary>
		/// 固话区号
		/// </summary>
		[DataMember]
		public string TELCODE
		{
			get{return _telcode;}
			set{
				if ( _telcode!= value)
				{
					 _telcode = value;
					OnPropertyChanged("TELCODE");
				}
			}
		}
		/// <summary>
		/// 固话
		/// </summary>
		[DataMember]
		public string TEL
		{
			get{return _tel;}
			set{
				if ( _tel!= value)
				{
					 _tel = value;
					OnPropertyChanged("TEL");
				}
			}
		}
		/// <summary>
		/// 手机
		/// </summary>
		[DataMember]
		public string MOBILE
		{
			get{return _mobile;}
			set{
				if ( _mobile!= value)
				{
					 _mobile = value;
					OnPropertyChanged("MOBILE");
				}
			}
		}
		/// <summary>
		/// 客户电话区号
		/// </summary>
		[DataMember]
		public string HOMETELCODE
		{
			get{return _hometelcode;}
			set{
				if ( _hometelcode!= value)
				{
					 _hometelcode = value;
					OnPropertyChanged("HOMETELCODE");
				}
			}
		}
		/// <summary>
		/// 家庭电话
		/// </summary>
		[DataMember]
		public string HOMETEL
		{
			get{return _hometel;}
			set{
				if ( _hometel!= value)
				{
					 _hometel = value;
					OnPropertyChanged("HOMETEL");
				}
			}
		}
		/// <summary>
		/// 办公电话区号
		/// </summary>
		[DataMember]
		public string OFFICETELCODE
		{
			get{return _officetelcode;}
			set{
				if ( _officetelcode!= value)
				{
					 _officetelcode = value;
					OnPropertyChanged("OFFICETELCODE");
				}
			}
		}
		/// <summary>
		/// 办公电话
		/// </summary>
		[DataMember]
		public string OFFICETEL
		{
			get{return _officetel;}
			set{
				if ( _officetel!= value)
				{
					 _officetel = value;
					OnPropertyChanged("OFFICETEL");
				}
			}
		}
		/// <summary>
		/// 办公电话分机号
		/// </summary>
		[DataMember]
		public string OFFICETELSUB
		{
			get{return _officetelsub;}
			set{
				if ( _officetelsub!= value)
				{
					 _officetelsub = value;
					OnPropertyChanged("OFFICETELSUB");
				}
			}
		}
		/// <summary>
		/// 家庭住址
		/// </summary>
		[DataMember]
		public string HOMEADDR
		{
			get{return _homeaddr;}
			set{
				if ( _homeaddr!= value)
				{
					 _homeaddr = value;
					OnPropertyChanged("HOMEADDR");
				}
			}
		}
		/// <summary>
		/// 邮编
		/// </summary>
		[DataMember]
		public string POST
		{
			get{return _post;}
			set{
				if ( _post!= value)
				{
					 _post = value;
					OnPropertyChanged("POST");
				}
			}
		}
		/// <summary>
		/// E-mail
		/// </summary>
		[DataMember]
		public string EMAIL
		{
			get{return _email;}
			set{
				if ( _email!= value)
				{
					 _email = value;
					OnPropertyChanged("EMAIL");
				}
			}
		}
		/// <summary>
		/// 是否业务员默认为0,0否,1是
		/// </summary>
		[DataMember]
		public int ISSALESMAN
		{
			get{return _issalesman;}
			set{
				if ( _issalesman!= value)
				{
					 _issalesman = value;
					OnPropertyChanged("ISSALESMAN");
				}
			}
		}
		/// <summary>
		/// 是否休假默认为0,0否,1是
		/// </summary>
		[DataMember]
		public int ISHOLIDAYS
		{
			get{return _isholidays;}
			set{
				if ( _isholidays!= value)
				{
					 _isholidays = value;
					OnPropertyChanged("ISHOLIDAYS");
				}
			}
		}
		/// <summary>
		/// 是否离职默认为0,0否,1是
		/// </summary>
		[DataMember]
		public int ISLEAVE
		{
			get{return _isleave;}
			set{
				if ( _isleave!= value)
				{
					 _isleave = value;
					OnPropertyChanged("ISLEAVE");
				}
			}
		}
		/// <summary>
		/// 离职日期
		/// </summary>
		[DataMember]
		public Nullable<DateTime> LEAVEDATE
		{
			get{return _leavedate;}
			set{
				if ( _leavedate!= value)
				{
					 _leavedate = value;
					OnPropertyChanged("LEAVEDATE");
				}
			}
		}
		/// <summary>
		/// 是否机构负责人默认为0,0否,1是
		/// </summary>
		[DataMember]
		public int ISPRINCIPAL
		{
			get{return _isprincipal;}
			set{
				if ( _isprincipal!= value)
				{
					 _isprincipal = value;
					OnPropertyChanged("ISPRINCIPAL");
				}
			}
		}
		/// <summary>
		/// 备注
		/// </summary>
		[DataMember]
		public string REMARK
		{
			get{return _remark;}
			set{
				if ( _remark!= value)
				{
					 _remark = value;
					OnPropertyChanged("REMARK");
				}
			}
		}
		/// <summary>
		/// 设置为系统操作用户0否，1是
		/// </summary>
		[DataMember]
		public int ISUSER
		{
			get{return _isuser;}
			set{
				if ( _isuser!= value)
				{
					 _isuser = value;
					OnPropertyChanged("ISUSER");
				}
			}
		}
		/// <summary>
		/// 用户名唯一
		/// </summary>
		[DataMember]
		public string USERNAME
		{
			get{return _username;}
			set{
				if ( _username!= value)
				{
					 _username = value;
					OnPropertyChanged("USERNAME");
				}
			}
		}
		/// <summary>
		/// 登录密码
		/// </summary>
		[DataMember]
		public string LOGPWD
		{
			get{return _logpwd;}
			set{
				if ( _logpwd!= value)
				{
					 _logpwd = value;
					OnPropertyChanged("LOGPWD");
				}
			}
		}
		/// <summary>
		/// 密码随机码
		/// </summary>
		[DataMember]
		public string PWDRAND
		{
			get{return _pwdrand;}
			set{
				if ( _pwdrand!= value)
				{
					 _pwdrand = value;
					OnPropertyChanged("PWDRAND");
				}
			}
		}
		/// <summary>
		/// 用户类型1为管理员,2为一般用户
		/// </summary>
		[DataMember]
		public int USERTYPE
		{
			get{return _usertype;}
			set{
				if ( _usertype!= value)
				{
					 _usertype = value;
					OnPropertyChanged("USERTYPE");
				}
			}
		}
		/// <summary>
		/// 最后一次登录时间
		/// </summary>
		[DataMember]
		public Nullable<DateTime> LASTLOGINDATE
		{
			get{return _lastlogindate;}
			set{
				if ( _lastlogindate!= value)
				{
					 _lastlogindate = value;
					OnPropertyChanged("LASTLOGINDATE");
				}
			}
		}
		/// <summary>
		/// 用户状态1有效,0无效,默认为1
		/// </summary>
		[DataMember]
		public int USERSTATUS
		{
			get{return _userstatus;}
			set{
				if ( _userstatus!= value)
				{
					 _userstatus = value;
					OnPropertyChanged("USERSTATUS");
				}
			}
		}
		/// <summary>
		/// 创建人关联操作用户名。
		/// </summary>
		[DataMember]
		public string CREATEBY
		{
			get{return _createby;}
			set{
				if ( _createby!= value)
				{
					 _createby = value;
					OnPropertyChanged("CREATEBY");
				}
			}
		}
		/// <summary>
		/// 创建时间
		/// </summary>
		[DataMember]
		public Nullable<DateTime> CREATETIME
		{
			get{return _createtime;}
			set{
				if ( _createtime!= value)
				{
					 _createtime = value;
					OnPropertyChanged("CREATETIME");
				}
			}
		}
		/// <summary>
		/// 修改人关联操作用户名
		/// </summary>
		[DataMember]
		public string MODIFYBY
		{
			get{return _modifyby;}
			set{
				if ( _modifyby!= value)
				{
					 _modifyby = value;
					OnPropertyChanged("MODIFYBY");
				}
			}
		}
		/// <summary>
		/// 修改时间
		/// </summary>
		[DataMember]
		public Nullable<DateTime> MODIFYTIME
		{
			get{return _modifytime;}
			set{
				if ( _modifytime!= value)
				{
					 _modifytime = value;
					OnPropertyChanged("MODIFYTIME");
				}
			}
		}
		#endregion Model

	#region ChangeTracking
	   
	protected virtual void OnPropertyChanged(String propertyName)
	{
	    if (ChangeTracker.State != ObjectState.Added && ChangeTracker.State != ObjectState.Deleted)
	    {
	        ChangeTracker.State = ObjectState.Modified;
	    }
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	protected virtual void OnNavigationPropertyChanged(String propertyName)
	{
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged{ add { _propertyChanged += value; } remove { _propertyChanged -= value; } }
	private event PropertyChangedEventHandler _propertyChanged;
	private ObjectChangeTracker _changeTracker;
	   
	[DataMember]
	public ObjectChangeTracker ChangeTracker
	{
	    get
	    {
	        if (_changeTracker == null)
	        {
	            _changeTracker = new ObjectChangeTracker();
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	        return _changeTracker;
	    }
	    set
	    {
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging -= HandleObjectStateChanging;
	        }
	        _changeTracker = value;
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	    }
	}
	   
	private void HandleObjectStateChanging(object sender, ObjectStateChangingEventArgs e)
	{
	    if (e.NewState == ObjectState.Deleted)
	    {
	        ClearNavigationProperties();
	    }
	}
	   
	protected bool IsDeserializing { get; private set; }
	   
	[OnDeserializing]
	public void OnDeserializingMethod(StreamingContext context)
	{
	    IsDeserializing = true;
	}
	   
	[OnDeserialized]
	public void OnDeserializedMethod(StreamingContext context)
	{
	    IsDeserializing = false;
	    ChangeTracker.ChangeTrackingEnabled = true;
	}
	   
	protected virtual void ClearNavigationProperties()
	{
	}
	
	#endregion

	}
}

